package com.lzy.xmlservice;

import com.lzy.xmlspring.XmlApplicationContext;

public class Test {
	public static void main(String[] args) {
		// 从类路径中进行获取
		XmlApplicationContext application = new XmlApplicationContext("spring-config.xml");

		UserInterface userService1 = (UserInterface)application.getBean("userService");
		UserInterface userService2 = (UserInterface)application.getBean("userService");
		UserInterface userService3 = (UserInterface)application.getBean("userService");

		userService1.test();
		userService2.test();
		userService3.test();
		/* 执行结果  --》 三个不同的UserService实例对象
		执行test()方法......com.lzy.xmlservice.UserService@1540e19d
		执行test()方法......com.lzy.xmlservice.UserService@677327b6
		执行test()方法......com.lzy.xmlservice.UserService@14ae5a5
		 */

		OrderService orderService = (OrderService)application.getBean("orderService");
		System.out.println(orderService);
	}
}
